﻿using QYmall.Core.Common.Emum;
using QYmall.Core.Common.Helper;
using QYmall.Core.Model.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace QYmall.Core.IServices
{
    /// <summary>
    /// 商户文章接口
    /// </summary>
    public interface IMerchantArticleService : IBaseService
    {
        /// <summary>
        /// 查询一条记录
        /// </summary>
        Task<MerchantArticle?> QueryAsync(Expression<Func<MerchantArticle, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 查询文章前几条数据
        /// </summary>
        Task<IEnumerable<MerchantArticle>> QueryListAsync(int top, Expression<Func<MerchantArticle, bool>> funcWhere, string orderBy, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 查询文章分页数据
        /// </summary>
        Task<PaginationList<MerchantArticle>> QueryPageAsync(int pageSize, int pageIndex,
            Expression<Func<MerchantArticle, bool>> funcWhere, string orderBy, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 更新数据(局部更新)
        /// </summary>
        Task<bool> UpdateAsync(MerchantArticle model, Expression<Func<MerchantArticle, int>> funcProperty, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 更新浏览量(局部更新)
        /// </summary>
        Task<int> UpdateClickAsync(int articleId, int clickCount, WriteRoRead writeAndRead = WriteRoRead.Write);
    }
}
